Skip to content

Use the digest's own Asia/Shanghai day in the digest header - #2620

Merged
Birfy merged 1 commit into
mainfrom
dev/2618-digest-header-zone-day
Nov 7, 2026
Merged

Birfy merged 1 commit into
mainfrom
dev/2618-digest-header-zone-day

Conversation

@Birfy

@Birfy Birfy commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

Written-by: Dev

Fixes #2618
Owner: Dev
Reviewer: Reviewer

What changed

buildDigest printed the header as a UTC date (new Date(at).toISOString().slice(0, 10)) while day and the idempotency check used the digest's own Asia/Shanghai calendar day (dayIn). Between 00:00 and 08:00 Asia/Shanghai the header therefore named yesterday, and a digest held by quiet hours and replayed later carried the wrong date in its body too.

The header now uses dayIn(at), the same function as the archive day; the private stamp helper is gone, so this file spells a calendar day one way. DIGEST_ZONE, DIGEST_TIME, the 09:00 task, the idempotency key, the digest's section wording and the per-owner block are untouched.

The regression test pins 2026-11-08T00:30:00+08:00 and asserts both day and the header name 2026-11-08, so the machine's TZ cannot change the answer.

docs/subsystems/core-host.md records the change for the owned file; patches/ds-bot/files/ mirrors the two changed core files byte for byte and ds-bot-patches.mjs check proves core/ equals ds-bot/ + patches.

Ran at this tip:

$ cd core && TZ=UTC DSH_HARNESS=/data/dsh/bot/workspace/d2607/repo/core/dev/harness node --import ./test/harness-resolve.mjs --test test/project-assistant.test.js
# tests 28 / pass 28 / fail 0

$ # red proof: same test file, base source restored in a scratch copy
$ cd /data/tmp2618/red/core && TZ=UTC DSH_HARNESS=/data/dsh/bot/workspace/d2607/repo/core/dev/harness node --import ./test/harness-resolve.mjs --test test/project-assistant.test.js
not ok 12 - the digest header names the Shanghai day the digest is filed under
+ actual   'Project Assistant (Edge) — 2026-11-07: no change since the previous digest.'
- expected 'Project Assistant (Edge) — 2026-11-08: no change since the previous digest.'
# tests 28 / pass 27 / fail 1

$ node scripts/ds-bot-patches.mjs check
ok   10 patches apply cleanly in order
ok   core/ equals ds-bot/ + patches/ds-bot/

$ cd core && /data/dsh/bot/workspace/d2607/ox/node_modules/.bin/oxlint src test
Found 81 warnings and 0 errors.

$ node .github/scripts/changelog.mjs check
changelog: 19 fragment(s) in changelog.d/ are well formed

$ diff -rq /data/tmp2618/base /data/dsh/bot/workspace/i2618-impl/repo
Only in repo/changelog.d: 2618.fixed.md
Files core/src/host/project-assistant.js and .../core/src/host/project-assistant.js differ
Files core/test/project-assistant.test.js and .../core/test/project-assistant.test.js differ
Files docs/subsystems/core-host.md and .../docs/subsystems/core-host.md differ
Files patches/ds-bot/files/src/host/project-assistant.js and ... differ
Files patches/ds-bot/files/test/project-assistant.test.js and ... differ

Not run, and why: full npm run verify (the brief scopes this to the target test); ds-bot-patches.mjs generate (this box has no git — the two changed core files are whole-file mirrors, copied byte for byte and proven by check); check-arch-docs.mjs (needs origin/main, no git here; the owned page is updated in this diff).

Checkpoint

{
"pr": 2620,
"claim": "Dev",
"issue": 2618,
"summary": "The digest header now names the same Asia/Shanghai calendar day the digest is filed under, using dayIn(at) instead of a UTC ISO slice, and the private stamp helper is gone. A digest built between 00:00 and 08:00 used to print yesterday's date, including one held by quiet hours and replayed later. A regression test pins 2026-11-08T00:30:00+08:00 and asserts both day and the header say 2026-11-08; it fails on the base source. DIGEST_ZONE, the 09:00 task, the idempotency key, the digest wording and the per-owner block are unchanged.",
"files": [
"core/src/host/project-assistant.js",
"core/test/project-assistant.test.js",
"patches/ds-bot/files/src/host/project-assistant.js",
"patches/ds-bot/files/test/project-assistant.test.js",
"docs/subsystems/core-host.md",
"changelog.d/2618.fixed.md"
],
"checks": {
"ran": "node --test test/project-assistant.test.js (TZ=UTC); node scripts/ds-bot-patches.mjs check; oxlint src test; node .github/scripts/changelog.mjs check",
"result": "green",
"at": "06e996ebb228a1af8334ddc647fe18a19cce8b18"
},
"next": "none — ready for Reviewer PASS at this tip; not enqueued by Dev"
}

buildDigest printed the header from a UTC ISO date while the archived day
and the idempotency check used dayIn in DIGEST_ZONE, so a digest built
between 00:00 and 08:00 named yesterday - and a quiet-hours replay carried
that wrong date in its body.

The header now calls dayIn(at); the private stamp helper is removed, so
this file spells a calendar day one way.

Refs #2618
@Birfy Birfy added the agent-pr Pull request opened by an agent label Nov 7, 2026
@Birfy Birfy self-assigned this Nov 7, 2026
@Birfy

Birfy commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator Author

Verdict: PASS at 06e996e
Written-by: Reviewer
Attestation: 06e996e role=Reviewer

Ran at this tip:

$ cd core && TZ=UTC DSH_HARNESS=/data/dsh/bot/workspace/d2607/repo/core/dev/harness node --import ./test/harness-resolve.mjs --test test/project-assistant.test.js
# tests 28  # pass 28  # fail 0

$ # red proof: tip tree with core/src/host/project-assistant.js replaced by the base blob f833b1c6, same test file
$ cd red/core && TZ=UTC DSH_HARNESS=/data/dsh/bot/workspace/d2607/repo/core/dev/harness node --import ./test/harness-resolve.mjs --test test/project-assistant.test.js
not ok 12 - the digest header names the Shanghai day the digest is filed under
  expected: 'Project Assistant (Edge) — 2026-11-08: no change since the previous digest.'
  actual:   'Project Assistant (Edge) — 2026-11-07: no change since the previous digest.'
# tests 28  # pass 27  # fail 1

$ node scripts/ds-bot-patches.mjs check
ok   10 patches apply cleanly in order
ok   core/ equals ds-bot/ + patches/ds-bot/

$ cd core && /data/dsh/bot/workspace/d2607/ox/node_modules/.bin/oxlint src test
Found 81 warnings and 0 errors.

$ # independent buildDigest: at 2026-11-08T00:30:00+08:00 and 2026-11-08T09:30:00+08:00
2026-11-08T00:30:00+08:00 day=2026-11-08 header=Project Assistant (Edge) — 2026-11-08: no change since the previous digest.
2026-11-08T09:30:00+08:00 day=2026-11-08 header=Project Assistant (Edge) — 2026-11-08: no change since the previous digest.

Review points:

  • Scope is the whole diff. compare f833b1c6...06e996eb: 6 files, +36/−9, ahead 1, nothing unrelated — core/src/host/project-assistant.js (+1/−3), core/test/project-assistant.test.js (+16), docs/subsystems/core-host.md (+1/−1), changelog.d/2618.fixed.md (+1), and the two generated patches/ds-bot/files/ mirrors.
  • Source change is exactly what is claimed. The hunk deletes the private stamp = at => new Date(at).toISOString().slice(0, 10) and changes the header from ${stamp(at)} to ${dayIn(at)}. DIGEST_ZONE = 'Asia/Shanghai', DIGEST_TIME = '09:00', dayIn itself, the day field, the idempotency key and the 09:00 task are untouched; grep stamp finds no remaining use of the helper (only stamped/updatedAt, unrelated).
  • Red first, on the new assertion. Restoring the base source while keeping the tip test file gives 27/28 with the single failure at the new test (expected 2026-11-08, actual 2026-11-07); the tip tree is 28/28. The test pins an explicit +08:00 instant, so the machine TZ cannot mask the bug.
  • Zone independence confirmed independently. buildDigest at 2026-11-08T00:30:00+08:00 answers day = 2026-11-08 and a header naming 2026-11-08; at 2026-11-08T09:30:00+08:00 it also answers 2026-11-08, i.e. the same day it produced before the change — no new date appears for an afternoon digest.
  • Generated files are in step. cmp shows both patches/ds-bot/files/ mirrors byte-identical to their core/ sources, and ds-bot-patches.mjs check reports 10 patches apply cleanly and core/ equals ds-bot/ + patches. No mojibake risk: one changed character run (stamp → dayIn).
  • Docs and changelog. The owned core-host.md paragraph records the Project digest header prints the previous day between 00:00 and 08:00 Asia/Shanghai #2618 change in place (one line changed), and changelog.d/2618.fixed.md is one well-formed fragment.
  • Checks at the tip. tests-ok success; merge-gate success; enqueue-guard is red only with no Verifier report names the tip 06e996ebb228, which this report clears. Body carries Fixes #2618, Owner: Dev, Reviewer: Reviewer (not the same Bot), label agent-pr, and a checkpoint block of 1229 characters with 6 files, summary 535 chars, at this tip.

Not run: full npm run verify (scoped brief; the targeted suite plus patches check and oxlint cover this diff); ds-bot-patches.mjs generate (no git on this box, and the mirrors are already byte-identical).

@github-actions github-actions Bot added the pass label Nov 7, 2026
@Birfy
Birfy added this pull request to the merge queue Nov 7, 2026
Merged via the queue into main with commit 0df3a54 Nov 7, 2026
17 of 18 checks passed
@Birfy
Birfy deleted the dev/2618-digest-header-zone-day branch November 7, 2026 16:25
@github-actions github-actions Bot removed the agent-pr Pull request opened by an agent label Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Project digest header prints the previous day between 00:00 and 08:00 Asia/Shanghai

1 participant